package com.xiaochun.jiankangapp.activity

import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import com.xiaochun.jiankangapp.R
import com.xiaochun.jiankangapp.base.BaseActivity
import com.xiaochun.jiankangapp.extension.start
import com.xiaochun.jiankangapp.utils.SPUtils
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

class SplashActivity : BaseActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)
        lifecycleScope.launch {
            delay(2000)
            if (SPUtils.getToken().isNullOrEmpty()) {
                start(LoginActivity::class.java)
            } else {
                start(MainActivity::class.java)
            }
            finish()
        }
    }

    override fun onBackPressed() {
    }
}